<template>
	<view class="slide-show">
		<swiper class="swiper" :indicator-dots="indicatorDots" indicator-color='rgba(230, 230, 230, 1)'
			indicator-active-color='rgba(255, 206, 1, 1)' :autoplay="autoplay" :interval="interval"
			:duration="duration">
			<block v-for="(item,index) in bannerList" :key="index">
				<swiper-item class="swiper-item" @tap='itemClick(item)'>
						<image :src="item.img_url"></image>
				</swiper-item>
			</block>
		</swiper>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				indicatorDots: true,
				autoplay: true,
				interval: 2000,
				duration: 1000,
			}
		},
		props: {
			bannerList: {
				type: Array,
				default: () => []
			},

		},
		methods: {
			itemClick(item) {
				console.log(item)
				if(item.commodity_id){
					uni.navigateTo({
						url: '/pages/shopDetail/shopDetail?goodsId=' + item.commodity_id
					})
				}
			
				this.$emit('itemClick', item)
			}
		}
	}
</script>

<style lang="scss">
	.slide-show {

		height: 314rpx;
		border-radius: 16rpx;
		margin-top: 30rpx;
		width: 702rpx;



		.swiper {
			height: 314rpx;
			border-radius: 16rpx;

			.swiper-item {
				height: 314rpx;
				width: 100%;
				border-radius: 16rpx;

				image {
					height: 100%;
					width: 100%;
					border-radius: 16rpx;
				}
			}
		}
	}
</style>
